#include <mockcpp/mockcpp.hpp>

#include <testngpp/testngpp.hpp>
#include <Volume.h>
#include <Length.h>

USING_MOCKCPP_NS
USING_TESTNGPP_NS

FIXTURE(Length)
{
        TEST(should be able to compare the length of Mile unit and Yard unit:1 mile == 1760 yard )
        {
                ASSERT_EQ(Length(1, MILE), Length(1760, YARD));
        }

        TEST(should be able to compare the length of Mile unit and Yard unit:1 mile != 3 yard )
        {
                ASSERT_NE(Length(1, MILE), Length(3, YARD));
        }
     
	TEST(should be able to compare the length of Yard unit and Feet Unit: 100 yard == 300 feet)
	{
		ASSERT_EQ(Length(100, YARD), Length(300, FEET));
	}

        TEST(should be able to compare the length of Yard unit and Feet Unit: 1 yard != 2 feet)
        {
                ASSERT_NE(Length(1, YARD), Length(2, FEET));
        }


	TEST(should be able to compare Mile + Yard length:1 mile +  9 yard == 1769 yard)
        {
                ASSERT_EQ(Length(1, MILE) + Length(9, YARD), Length(1769, YARD));
        }
	
        TEST(should be able to compare Mile + Yard length: 5 feet +  19 yard == 62 feet)
        {
                ASSERT_EQ(Length(5, FEET) + Length(19, YARD), Length(62, FEET));
        }

        TEST(should be able to compare Mile + Yard length: 5 feet +  19.9 yard == 62 feet)
        {
                ASSERT_EQ(Length(5, FEET) + Length(19.9, YARD), Length(62, FEET));
		FEET;
        }
        //abnormal cases bellow
#if 0
	TEST(should not  be able to compare mile unit and oz unit as equal: 1 feet == 1 tsp)
	{
			bool result = (Length(1, FEET) == Volume(1 , TSP));
			LengthUnit Haomin(1000);
	}
#endif
};
FIXTURE(TestPrintMode0, "Print MODE 0")
{
        TEST("should be able to display like '0 Feet' for 0 Yard")
        {
                Length len(0, YARD);
                ASSERT_TRUE("0 Feet" == len.print(0));
        }

	TEST("should be able to display like '1 Mile 1 Yard' for 1761 YARD")
        {
		Length len(1761,YARD);
		ASSERT_TRUE("1 Mile 1 Yard" == len.print());
        }

        TEST("should be able to display like '1 Yard 1 Feet' for 4 Feet")
        {
                Length len(4,FEET);
                ASSERT_TRUE("1 Yard 1 Feet" == len.print());
        }

	TEST("should be able to display like '1 Mile' for 5280 Feet")
        {
                Length len(5280,FEET);
                ASSERT_TRUE("1 Mile" == len.print());
        }

        TEST("should be able to display like '1 Mile 1 Feet' for 5281 Feet")
        {
                Length len(5281,FEET);
                ASSERT_TRUE("1 Mile 1 Feet" == len.print());
        }

        TEST("should be able to display like '33 Yard' for 99 Feet")
        {
                Length len(99,FEET);
                ASSERT_TRUE("33 Yard" == len.print());
        }

	TEST("should be able to display like '1 Mile 1 Yard 1 Feet' for 5284 Feet")
        {
                Length len(5284,FEET);
                ASSERT_TRUE("1 Mile 1 Yard 1 Feet" == len.print());
        }
};

FIXTURE(TestPrintMode1, "Print MODE 1")
{
        TEST("should be able to display like '1 Mile' for 5280 Feet")
        {
                Length len(1,MILE);
                ASSERT_TRUE("5280 Feet" == len.print(1));
        }
        TEST("should be able to display like '5284 Feet' for 5284 Feet")
        {
                Length len(5284,FEET);
                ASSERT_TRUE("5284 Feet" == len.print(1));
        }
        TEST("should be able to display like '3 Feet' for 1 Yard")
        {
                Length len(1,YARD);
                ASSERT_TRUE("3 Feet" == len.print(1));
        }

        TEST("should be able to display like '0 Feet' for 0 yard")
        {
                Length len(0, YARD);
                ASSERT_TRUE("0 Feet" == len.print(1));
        }

    	TEST(" print mode can not be other than MODE0 MODE1")
    	{
		Length len(0, YARD);
		ASSERT_THROWS(len.print(10), std::invalid_argument/*("INVAID_UNIT_PRINT_MODE")*/);
    	} 
#if 0
	//MODE 3 and MODE4 
        TEST("should be able to display like '1761 Yard 1 Feet' for 1 Yard")
        {
                Length len(5284,FEET);
                ASSERT_TRUE("1761 Yard 1 Feet" == len.print(2));
        }

        TEST("should be able to display like '1 Mile 1 Yard' for 5284 Feet")
        {
                Length len(5284,FEET);
                ASSERT_TRUE("1 Mile 1 Yard" == len.print(3));
        }
#endif 
};
